package mybatis.controller;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import mybatis.entity.User;
import mybatis.service.UserService;
import org.springframework.stereotype.Controller;

/**
 * Author：汤小洋
 * Date：2023-09-20 11:40
 * Description：<描述>
 */
@Controller
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    public void register(User user){
        try {
            userService.register(user);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    public User login(String username,String password){
        return userService.login(username, password);
    }

    public PageInfo<User> findPage(int pageNum,int pageSize){
        return userService.findPage(pageNum, pageSize);
    }

}
